<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>商品库存预测系统</title>
    <link href="{{ url_for('static', filename='bootstrap.min.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='fontawesome.min.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='inter.css') }}" rel="stylesheet">
    <style>
        :root {
            --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
            --warning-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
            --dark-gradient: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
            --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.07);
            --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.1);
            --shadow-heavy: 0 15px 35px rgba(0, 0, 0, 0.1);
            --border-radius: 20px;
            --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        * {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
        }

        body {
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }

        /* 导航栏样式 */
        .navbar {
            background: rgba(255, 255, 255, 0.95) !important;
            backdrop-filter: blur(10px);
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
            box-shadow: var(--shadow-light);
        }

        .navbar-brand {
            font-weight: 700;
            font-size: 1.5rem;
            background: var(--primary-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .nav-link {
            font-weight: 500;
            transition: var(--transition);
            position: relative;
        }

        .nav-link:hover {
            transform: translateY(-2px);
        }

        .nav-link::after {
            content: '';
            position: absolute;
            bottom: -5px;
            left: 50%;
            width: 0;
            height: 2px;
            background: var(--primary-gradient);
            transition: var(--transition);
            transform: translateX(-50%);
        }

        .nav-link:hover::after {
            width: 100%;
        }

        /* 英雄区域样式 */
        .hero-section {
            background: var(--primary-gradient);
            color: white;
            padding: 4rem 0;
            margin-bottom: 3rem;
            position: relative;
            overflow: hidden;
        }

        .hero-section::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
            opacity: 0.3;
        }

        .hero-content {
            position: relative;
            z-index: 2;
        }

        .hero-title {
            font-weight: 800;
            font-size: 3.5rem;
            margin-bottom: 1.5rem;
            text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }

        .hero-subtitle {
            font-size: 1.3rem;
            font-weight: 400;
            opacity: 0.9;
            margin-bottom: 2rem;
        }

        .feature-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 2rem;
            margin-top: 3rem;
        }

        .feature-item {
            text-align: center;
            padding: 1.5rem;
            background: rgba(255, 255, 255, 0.1);
            border-radius: var(--border-radius);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            transition: var(--transition);
        }

        .feature-item:hover {
            transform: translateY(-5px);
            background: rgba(255, 255, 255, 0.2);
        }

        .feature-icon {
            font-size: 2.5rem;
            margin-bottom: 1rem;
            opacity: 0.9;
        }

        /* 卡片样式 */
        .card {
            border: none;
            border-radius: var(--border-radius);
            box-shadow: var(--shadow-light);
            transition: var(--transition);
            overflow: hidden;
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(10px);
        }

        .card:hover {
            transform: translateY(-8px);
            box-shadow: var(--shadow-heavy);
        }

        .card-header {
            background: var(--primary-gradient);
            color: white;
            border: none;
            padding: 1.5rem;
            font-weight: 600;
        }

        .card-body {
            padding: 2rem;
        }

        /* 上传区域样式 */
        .upload-area {
            border: 2px dashed #e0e6ed;
            border-radius: var(--border-radius);
            padding: 2rem;
            text-align: center;
            background: #f8f9fa;
            transition: var(--transition);
        }

        .upload-area::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
            transition: left 0.5s;
        }

        .upload-area:hover::before {
            left: 100%;
        }

        .upload-area:hover {
            border-color: #667eea;
            background: #f0f4ff;
            transform: none;
        }

        .upload-icon {
            font-size: 2.5rem;
            color: #667eea;
            margin-bottom: 1rem;
            opacity: 0.7;
        }

        .upload-text {
            font-size: 1.1rem;
            color: #495057;
            margin-bottom: 1rem;
        }

        .upload-hint {
            font-size: 0.85rem;
            color: #6c757d;
            opacity: 0.8;
        }

        /* 新增：美化文件输入按钮 */
        .btn-outline-primary {
            transition: var(--transition);
        }

        .btn-outline-primary:hover {
            letter-spacing: 0.5px;
        }

        /* 模型状态样式 */
        .model-status {
            background: rgba(255, 255, 255, 0.95);
            border-radius: var(--border-radius);
            padding: 1.5rem;
            margin-bottom: 2rem;
            box-shadow: var(--shadow-light);
            border-left: 4px solid #667eea;
        }

        .status-item {
            display: flex;
            align-items: center;
            margin-bottom: 0.5rem;
        }

        .status-icon {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            margin-right: 10px;
            display: inline-block;
        }

        .status-icon.loading {
            background: #ffc107;
            animation: pulse 1.5s infinite;
        }

        .status-icon.success {
            background: #28a745;
        }

        .status-icon.error {
            background: #dc3545;
        }

        @keyframes pulse {
            0% { opacity: 1; }
            50% { opacity: 0.5; }
            100% { opacity: 1; }
        }

        /* 性能提示样式 */
        .performance-tips {
            background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
            border: 1px solid #ffeaa7;
            border-radius: var(--border-radius);
            padding: 1.5rem;
            margin-bottom: 2rem;
        }

        .performance-tips h5 {
            color: #856404;
            margin-bottom: 1rem;
        }

        .performance-tips ul {
            color: #856404;
            margin-bottom: 0;
        }

        .performance-tips li {
            margin-bottom: 0.5rem;
        }

        /* 新增：手风琴（Accordion）样式覆盖 */
        .accordion-item {
            border-radius: var(--border-radius) !important;
            border: none;
            box-shadow: var(--shadow-light);
            background-color: rgba(255, 255, 255, 0.9);
        }

        .accordion-button {
            border-radius: var(--border-radius) !important;
            background: var(--primary-gradient);
            color: white;
        }

        .accordion-button:not(.collapsed) {
            color: white;
            background: var(--primary-gradient);
            box-shadow: none;
        }

        .accordion-button:focus {
            box-shadow: none;
        }

        .accordion-button::after {
            background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
        }

        .accordion-body {
            padding: 2rem;
        }

        /* 按钮样式 */
        .btn {
            border-radius: 50px;
            padding: 12px 30px;
            font-weight: 600;
            transition: var(--transition);
            border: none;
            position: relative;
            overflow: hidden;
        }

        .btn-primary {
            background: var(--primary-gradient);
            box-shadow: var(--shadow-light);
        }

        .btn-primary:hover {
            transform: translateY(-3px);
            box-shadow: var(--shadow-medium);
        }

        .btn-primary::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: left 0.5s;
        }

        .btn-primary:hover::before {
            left: 100%;
        }

        .btn-outline-primary {
            border: 2px solid #667eea;
            color: #667eea;
            background: transparent;
        }

        .btn-outline-primary:hover {
            background: var(--primary-gradient);
            border-color: transparent;
            transform: translateY(-2px);
        }

        /* 表格样式 */
        .table-container {
            background: rgba(255, 255, 255, 0.95);
            border-radius: var(--border-radius);
            box-shadow: var(--shadow-medium);
            overflow: hidden;
            backdrop-filter: blur(10px);
        }

        .table {
            margin-bottom: 0;
        }

        .table thead th {
            background-color: #343a40;
            color: white;
            font-weight: 600;
            border-top: none;
            position: sticky;
            top: 0;
            z-index: 3;
            white-space: nowrap;
            text-align: center;
            vertical-align: middle;
            font-size: 0.9rem;
            padding: 0.75rem 1rem;
        }

        /* --- 新增：固定操作列 --- */
        /* .table th:last-child, */
        .table td:last-child {
            /* position: -webkit-sticky;  for Safari */
            position: sticky;
            right: 0;
            z-index: 2;
        }

        .table th:last-child {
            z-index: 4; /* 确保操作列的表头在最上层 */
        }
        
        .table td:last-child {
            background-color: #ffffff; /* 添加白色背景以覆盖下方滚动内容 */
            box-shadow: -2px 0 5px rgba(0,0,0,0.05); /* 添加细微阴影以示区分 */
        }

        .table-hover > tbody > tr:hover > td:last-child {
            background-color: #f8f9fa; /* 确保悬停时背景色一致 */
        }
        /* --- 固定操作列结束 --- */

        .table tbody tr {
            transition: var(--transition);
        }

        .table tbody tr:hover {
            --bs-table-accent-bg: #f8f9fa; /* Lighter shade for hover */
            transform: scale(1.01);
        }

        .table tbody td {
            padding: 1rem;
            border: none;
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
            vertical-align: middle;
        }

        /* 警告样式 */
        .alert {
            border-radius: var(--border-radius);
            border: none;
            padding: 1.5rem;
            font-weight: 500;
        }

        /* 页脚样式 */
        footer {
            background: var(--dark-gradient);
            color: white;
            padding: 2rem 0;
            margin-top: 4rem;
        }

        /* 动画效果 */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .fade-in-up {
            animation: fadeInUp 0.6s ease-out;
        }

        .fade-in-up-delay-1 {
            animation: fadeInUp 0.6s ease-out 0.1s both;
        }

        .fade-in-up-delay-2 {
            animation: fadeInUp 0.6s ease-out 0.2s both;
        }

        .fade-in-up-delay-3 {
            animation: fadeInUp 0.6s ease-out 0.3s both;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .hero-title {
                font-size: 2.5rem;
            }
            
            .feature-grid {
                grid-template-columns: 1fr;
            }
            
            .card-body {
                padding: 1.5rem;
            }
        }

        /* 加载动画 */
        .loading-spinner {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            border-top-color: #fff;
            animation: spin 1s ease-in-out infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        /* 新增：统一首页功能卡片高度和宽度 */
        .feature-card {
            min-width: 340px;
            max-width: 100%;
            min-height: 270px;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
        }
        @media (min-width: 768px) {
            .feature-card {
                height: 270px;
            }
        }
        .feature-card .card-body {
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-light fixed-top">
        <div class="container">
            <a class="navbar-brand" href="{{ url_for('index') }}">
                <i class="fas fa-chart-line me-2"></i>AI库存预测
            </a>
            <div class="navbar-nav ms-auto">
                <a class="nav-link" href="{{ url_for('manual') }}">
                    <i class="fas fa-book me-1"></i>使用说明
                </a>
{#                <a class="nav-link" href="{{ url_for('clear_session') }}">#}
{#                    <i class="fas fa-trash me-1"></i>清除数据#}
{#                </a>#}
{#                <a class="nav-link" href="{{ url_for('single_predict') }}">#}
{#                    <i class="fas fa-magic me-1"></i>单商品预测#}
{#                </a>#}
            </div>
        </div>
    </nav>

    <!-- 英雄区域 -->
    <div class="hero-section">
        <div class="container hero-content">
            <div class="row align-items-center">
                <div class="col-lg-8 text-center text-lg-start">
                    <h1 class="hero-title fade-in-up">
                        <i class="fas fa-robot me-3"></i>AI驱动的智能库存管理
                    </h1>
                    <p class="hero-subtitle fade-in-up-delay-1">
                        基于机器学习的商品级别预测系统，为每个商品提供个性化的需求分析和库存优化建议
                    </p>
                </div>
                <div class="col-lg-4">
                    <div class="feature-grid">
                        <div class="feature-item fade-in-up-delay-2">
                            <div class="feature-icon">
                                <i class="fas fa-chart-bar"></i>
                            </div>
                            <h5>商品级别预测</h5>
                            <small>每个商品独立建模</small>
                        </div>
                        <div class="feature-item fade-in-up-delay-3">
                            <div class="feature-icon">
                                <i class="fas fa-brain"></i>
                            </div>
                            <h5>智能算法</h5>
                            <small>Prophet时间序列模型</small>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="container" style="margin-top: 2rem;">
        <div class="row justify-content-center g-4">
            <div class="col-md-6 col-lg-5 d-flex">
                <div class="card text-center shadow-lg fade-in-up feature-card w-100">
                    <div class="card-header">
                        <h4 class="mb-0 fw-bold"><i class="fas fa-database me-2"></i>训练完成的商品模型</h4>
                    </div>
                    <div class="card-body">
                        <p class="lead mb-4">通过训练好的模型直接进行商品预测</p>
                        <a href="{{ url_for('product_data_manage') }}" class="btn btn-primary btn-lg">
                            <i class="fas fa-arrow-right me-2"></i>进入
                        </a>
                    </div>
                </div>
            </div>
            <div class="col-md-6 col-lg-5 d-flex">
                <div class="card text-center shadow-lg fade-in-up feature-card w-100">
                    <div class="card-header">
                        <h4 class="mb-0 fw-bold"><i class="fas fa-database me-2"></i>单个商品预测</h4>
                    </div>
                    <div class="card-body">
                        <p class="lead mb-4">上传商品最近一段时间内的销售数据进行训练预测</p>
                        <a href="{{ url_for('single_predict') }}" class="btn btn-primary btn-lg">
                            <i class="fas fa-arrow-right me-2"></i>进入
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 页脚 -->
    <footer class="text-center">
        <div class="container">
            <div class="row">
                <div class="col-md-6">
                    <h5><i class="fas fa-code me-2"></i>技术栈</h5>
                    <p class="mb-0">Python • Flask • Prophet • Bootstrap</p>
                </div>
                <div class="col-md-6">
                    <h5><i class="fas fa-chart-line me-2"></i>功能特性</h5>
                    <p class="mb-0">商品级别预测 • 智能库存优化 • 实时分析</p>
                </div>
            </div>
            <hr class="my-4" style="border-color: rgba(255,255,255,0.2);">
            <p class="mb-0">
                <i class="fas fa-heart me-1" style="color: #e74c3c;"></i>
                商品库存预测系统 | 基于机器学习的智能库存管理
            </p>
        </div>
    </footer>

</body>
<script src="{{ url_for('static', filename='bootstrap.bundle.min.js') }}"></script>
</html> 